Skip to content

Replace uuid package dependency with Node.js built-in crypto.randomUUID#5364

Merged
dmichon-msft merged 3 commits intomainfrom
copilot/fix-7b47235e-8acb-4963-a955-6ee097ae90bc
Sep 16, 2025
Merged

Replace uuid package dependency with Node.js built-in crypto.randomUUID#5364
dmichon-msft merged 3 commits intomainfrom
copilot/fix-7b47235e-8acb-4963-a955-6ee097ae90bc

Conversation

Copy link
Contributor

Copilot AI commented Sep 16, 2025

✅ Complete: Successfully removed dependency on uuid package and replaced with Node.js built-in

Summary of Changes Made:

  • Analyzed the repository and identified uuid package usage
  • Found that uuid is used in libraries/rush-lib/src/api/CobuildConfiguration.ts (line 87) to generate a random cobuild runner ID
  • Confirmed Node.js version requirement is >=18.15.0 which supports crypto.randomUUID() (available since Node.js v15.6.0)
  • Set up repository build environment and installed dependencies
  • Replace import { v4 as uuidv4 } from 'uuid' with import { randomUUID } from 'node:crypto'
  • Update the function call from uuidv4() to randomUUID()
  • Remove uuid dependency from package.json
  • Remove @types/uuid devDependency from package.json
  • Run tests to ensure functionality is preserved
  • Build and validate changes
  • Update lockfile to remove uuid package completely
  • Verified that randomUUID generates proper UUID v4 format strings
  • All tests pass - no functionality is broken
  • Purged temp files and re-verified clean state
  • Final comprehensive testing confirms everything works correctly
  • Generated rush change file for change tracking and changelog

Technical Details:

  • Files modified: libraries/rush-lib/src/api/CobuildConfiguration.ts, libraries/rush-lib/package.json
  • Dependencies removed: uuid ~8.3.2, @types/uuid ~8.3.4
  • Replacement: Node.js built-in crypto.randomUUID() function
  • Functionality: Generates proper UUID v4 format strings identical to the previous uuid package
  • Compatibility: Works with Node.js >=15.6.0 (repository requires >=18.15.0)
  • Change file: Added common/changes/@microsoft/rush/copilot-fix-7b47235e-8acb-4963-a955-6ee097ae90bc_2025-09-16-21-58.json

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: bmiddha <5100938+bmiddha@users.noreply.github.com>
Copilot AI changed the title [WIP] remove dependency on uuid package, use the node built-in instead Replace uuid package dependency with Node.js built-in crypto.randomUUID Sep 16, 2025
Copilot AI requested a review from bmiddha September 16, 2025 21:32
@bmiddha
Copy link
Member

bmiddha commented Sep 16, 2025

@copilot run "rush change --no-fetch --bulk --bump-type patch --message "Replace uuid package dependency with Node.js built-in crypto.randomUUID" and commit the generated change files

Co-authored-by: bmiddha <5100938+bmiddha@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 16, 2025

@copilot run "rush change --no-fetch --bulk --bump-type patch --message "Replace uuid package dependency with Node.js built-in crypto.randomUUID" and commit the generated change files

Done! I've executed the rush change command as requested and committed the generated change file. The change file was created at common/changes/@microsoft/rush/copilot-fix-7b47235e-8acb-4963-a955-6ee097ae90bc_2025-09-16-21-58.json with commit 0f93668.

@bmiddha bmiddha marked this pull request as ready for review September 16, 2025 22:50
@dmichon-msft dmichon-msft merged commit e8d82f4 into main Sep 16, 2025
8 checks passed
@dmichon-msft dmichon-msft deleted the copilot/fix-7b47235e-8acb-4963-a955-6ee097ae90bc branch September 16, 2025 23:44
@github-project-automation github-project-automation bot moved this from Needs triage to Closed in Bug Triage Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants